$.ajaxPrefilter(function (obj) {
    let base = 'http://api-breakingnews-web.itheima.net'

    obj.url = base + obj.url
    if (obj.url.indexOf("/my") != -1) {
        obj.headers = {
            Authorization: localStorage.getItem("token")
        }
        obj.complete = function (res) {
            let data = res.responseJSON;
            if (data.status == 1 && data.message == '身份认证失败！') {
                location.href = '/login.html'
                localStorage.removeItem("token")
            }
        }

    }

})